﻿using HamcoWcs.Entitys.Bases;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace HamcoWcs.Entitys.DeviceErrors
{
    public class DeviceErrorQueue : AuditEntity
    {
        public string PlcName { get; set; }
        public string MachineName { get; set; }
        public string PortName { get; set; }
        public string ErrorLevel { get; set; }
        public string ErrorCode { get; set; }
        public string ErrorDetail { get; set; }

    }


    public class DeviceErrorInfoConfig : IEntityTypeConfiguration<DeviceErrorQueue>
    {
        public void Configure(EntityTypeBuilder<DeviceErrorQueue> builder)
        {
            builder.HasComment("当前设备异常");
            builder.Property(x => x.PlcName).IsRequired().HasMaxLength(30).HasComment("PLC名");
            builder.Property(x => x.MachineName).IsRequired().HasMaxLength(30).HasComment("设备名");
            builder.Property(x => x.PortName).IsRequired().HasDefaultValue("").HasMaxLength(30).HasComment("Port名");
            builder.Property(x => x.ErrorLevel).IsRequired().HasMaxLength(30).HasComment("异常等级");
            builder.Property(x => x.ErrorCode).IsRequired().HasMaxLength(30).HasComment("异常代码");
            builder.Property(x => x.ErrorDetail).IsRequired().HasMaxLength(255).HasComment("异常说明");

        }
    }
}
